package com.ct.ah.lab.controller;

import com.ct.ah.lab.entity.Cart;
import com.ct.ah.lab.entity.District;
import com.ct.ah.lab.entity.User;
import com.ct.ah.lab.entity.vo.CartVo;
import com.ct.ah.lab.service.ICartService;
import com.ct.ah.lab.service.IDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/districts")
public class DistrictController {
    @Autowired
    private IDistrictService districtService;


    @RequestMapping(method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> create(String parent){
        Map<String,Object> map = new HashMap<>();

        List<District> districts = districtService.listByParent(parent);
        map.put("state",1000);
        map.put("data",districts);

        return map;
    }


}
